// **************************************************************
// *																		   *
// *	S Y M T A B				(Header)						   *
// *																		   *
// *	CLASSES:	SymbolTableEntry, SymbolTable	   *
// *																		   *
// **************************************************************

#ifndef	symtab_h
#define	symtab_h

#include <stdio.h>

#define SYMMAX  500			// maximum size of symbol table

//----------------------------------------------------------------
// SymbolTableEntry class
//----------------------------------------------------------------

class SymbolTableEntry {
private:	
	//const char*  m_lexeme;		// the lexeme
	char*  m_lexeme;		// the lexeme  -  symtab.h í uppfærða verkefninu skilgreinir breytuna sem char* en ekki const char*
    char*  m_tokenCode;         // the token
    char*  m_attribute;     // the attribute
    SymbolTableEntry* m_nextEntry;
							
public:
	SymbolTableEntry( char* lexeme, char* token, char* attribute);
    SymbolTableEntry( char* lexeme);
	// Get operations
	//const char *getLexeme(void);
	const char *getLexeme(void); 	// symtab.h í uppfærða verkefninu skilgreinir skilagildið sem char* en ekki const char*
    const char *getTokenCode(void);
    void setTokenCode(char* tokenCode);
    const char *getAttribute(void);
    void setAttribute( char* attribue );
    SymbolTableEntry *getNextEntry();
};

//----------------------------------------------------------------
// List of SymbolTableEntries 
//----------------------------------------------------------------

class EntryList {
private:
	SymbolTableEntry* m_entry;
	EntryList* m_next;

	void setEntry(SymbolTableEntry* entry);
    
public:
	EntryList();
	SymbolTableEntry* getEntry();
	EntryList* getNext();	
	void setNext(EntryList* eList);
    void addEntry(SymbolTableEntry* entry);    // adds an entry
	int count();					// count of items in list
};

//----------------------------------------------------------------
// SymbolTable class
//----------------------------------------------------------------

class SymbolTable {
private:
	SymbolTableEntry* m_entry[SYMMAX];
	int lastEntry;
public:
	SymbolTable(void);
	SymbolTableEntry* insert(char* lexeme);
	SymbolTableEntry* lookup(char* lexeme);
	void print(void);
};

#endif
